package org.nio;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;

/**
 * @author wind
 * @create 2025-01-07 16:25
 */
public class ChannelDataTransferDemo {
    public static void main(String[] args) throws IOException {
        FileChannel from = new FileInputStream("source.txt").getChannel();
        FileChannel to = new FileOutputStream("target.txt").getChannel();
        from.transferTo(0, from.size(), to);
    }
}
